export default {
  addTodo(
    state: { todos: { id: number; text: any; isFinished: boolean }[]; id: number },
    text: any
  ) {
    state.todos.push({
      id: state.id++,
      text,
      isFinished: false,
    });
  },
  toggleTodo(state: { todos: any[] }, id: any) {
    const todo = state.todos.find((todo: any) => todo.id === id);
    todo.isFinished = !todo.isFinished;
  },
  removeTodo(state: any, id: any) {
    state.todos = state.todos.filter((todo: any) => todo.id !== id);
  },
  setFilter(state: any[], filter: any) {
    state.filter = filter;
  },
};
